package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.PaymentUserEntity;
import com.xbongbong.saas.domain.entity.UserTeamEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/4/11 15:14
 * @since v1.0
 */
@Repository
@Mapper
public interface PaymentUserDao {
     Long insert(PaymentUserEntity entity);
    
    void insertBatch(@Param("list")List<PaymentUserEntity> paymentUserEntityList);

    void disbandedTeamByCustomerId(@Param("corpid") String corpid, @Param("customerIdIn") List<Long> customerIdList);

    void disbandedTeamByDataId(@Param("corpid") String corpid, @Param("dataIdIn") List<Long> dataIdList);

    List<PaymentUserEntity> findEntitys(@Param("param") Map<String,Object> param);

    Integer update(PaymentUserEntity paymentUserEntity);

    List<UserTeamEntity> findBaseEntitys(@Param("param") Map<String,Object> map);

    void batchDeleteById(@Param("corpid") String corpid, @Param("idIn") List<Long> removeIdList);

    /**
     * 批量修改
     *
     * @param corpid
     * @param dataIdIn
     * @param isMain
     * @param del
     */
    void batchUpdateByIdIn(@Param("corpid")String corpid, @Param("idIn")List<Long> dataIdIn, @Param("isMain")Integer isMain, @Param("del")Integer del);

    void updateBatchCustomerId(@Param("list") List<PaymentUserEntity> paymentUserEntityList, @Param("corpid") String corpid);

    void deleteBatch(@Param("list") List<Long> idList, @Param("corpid") String corpid);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * 批量修改团队里面成员为协同人以及协同人可编辑权限
     *
     * @param corpid
     * @param idIn
     * @param isMain
     * @param formPermission
     */
    void batchUpdateCoAndPerByUserIdIn(@Param("corpid")String corpid, @Param("idIn")List<Long> idIn, @Param("isMain")Integer isMain, @Param("formPermission")Integer formPermission);

    PaymentUserEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);
}
